<template>
  <div id="app">
    <router-view />
  </div>
</template>

<script>
import {request} from "@/assets/js/utils/request";
export default {
  name: 'App',
  destroy() {
    console.log('ddddddd')
    this.handleBeforeUnload()
    // window.removeEventListener('beforeunload', this.handleBeforeUnload);
  },
  mounted() {
    // window.removeEventListener('beforeunload', this.handleBeforeUnload);
  },
  methods: {
    handleBeforeUnload() {
      request({
        url: '/jaccountLogout.jsp',
        method: 'post'
      }).then(res => {
        if(res.code == 200) {
            localStorage.removeItem('token')
            localStorage.removeItem('userInfo')
            localStorage.removeItem('rightCodes')
        } else {
            this.$message.error(res.msg);
        }
    })
      // this.$store.commit('setToken', '')
      // this.$store.commit('setUserInfo', '')
      // this.$store.commit('setRightCodes', '')
      // localStorage.removeItem('token')
      // localStorage.removeItem('userInfo')
      // localStorage.removeItem('rightCodes')
    }
  }
}
</script>

<style>
#app{
  min-width: 1366px;
  height: 100%;
  margin: 0;
  padding: 0;
}
</style>